<%@ page language="java" contentType="text/html; charset=BIG5"
    pageEncoding="BIG5"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="html" uri="http://struts.apache.org/tags-html" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=BIG5">
<link rel="stylesheet" type="text/css" href="" />
<title>Product</title>
<script type="text/javascript">
function clearForm() {
  document.forms[0].id.value="";
  document.forms[0].name.value="";
  document.forms[0].price.value="";
  document.forms[0].make.value="";
  document.forms[0].expire.value="";
}
</script>
</head>
<body>

<h3>Welcome, ${user.custid}</h3>

<h3>Product Table</h3>
<h4><font color="red"><html:errors property="prodaction"/></font></h4>

<form action="<c:url value="/pages/product.do"/>" method="get">
<table>
	<tr>
		<td>ID : </td>
		<td><input type="text" name="id" value="${param.id}"></td>
		<td><font color="red"><html:errors property="id"/></font></td>
	</tr>
	<tr>
		<td>Name : </td>
		<td><input type="text" name="name" value="${param.name}"></td>
		<td><font color="red"><html:errors property="name"/></font></td>
	</tr>

	<tr>
		<td>Price : </td>
		<td><input type="text" name="price" value="${param.price}"></td>
		<td><font color="red"><html:errors property="price"/></font></td>
	</tr>
	<tr>
		<td>Make : </td>
		<td><input type="text" name="make" value="${param.make}"></td>
		<td><font color="red"><html:errors property="make"/></font></td>
	</tr>
	<tr>
		<td>Expire : </td>
		<td><input type="text" name="expire" value="${param.expire}"></td>
		<td><font color="red"><html:errors property="expire"/></font></td>
	</tr>
	<tr>
		<td>
			<input type="submit" name="prodaction" value="Insert">
			<input type="submit" name="prodaction" value="Update">
		</td>
		<td>
			<input type="submit" name="prodaction" value="Delete">
			<input type="submit" name="prodaction" value="Select">
			<input type="button" value="Clear" onclick="clearForm()">
		</td>
	</tr>
</table>

</form>
<h4><font color="red"><html:errors property="product"/></font></h4>
<c:if test="${not empty Insert}">
<h4><font color="blue">Insert Success!!!</font></h4>
<table>
	<tr>
		<td>ID : </td>
		<td>${Insert.id }</td>
		
	</tr>
	<tr>
		<td>Name : </td>
		<td>${Insert.name }</td>
		
	</tr>

	<tr>
		<td>Price : </td>
		<td>${Insert.price}</td>
		
	</tr>
	<tr>
		<td>Make : </td>
		<td>${Insert.make }</td>
		
	</tr>
	<tr>
		<td>Expire : </td>
		<td>${Insert.expire }</td>
		
	</tr>
</table>

</c:if>
<c:if test="${not empty Update}">
<h4><font color="blue">Update Success!!!</font></h4>
<table>
	<tr>
		<td>ID : </td>
		<td>${Update.id }</td>
		
	</tr>
	<tr>
		<td>Name : </td>
		<td>${Update.name }</td>
		
	</tr>

	<tr>
		<td>Price : </td>
		<td>${Update.price}</td>
		
	</tr>
	<tr>
		<td>Make : </td>
		<td>${Update.make }</td>
		
	</tr>
	<tr>
		<td>Expire : </td>
		<td>${Update.expire }</td>
		
	</tr>
</table>

</c:if>
<c:if test="${not empty Delete and Delete ne 0}">
<h4><font color="red">Delete Success!!!</font></h4>
</c:if>
</body>
</html>